package com.itheima.clientAndService01;

import java.io.IOException;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;
import java.util.Scanner;

public class SendDemo01 {
    public static void main(String[] args) throws IOException {
        DatagramSocket ds = new DatagramSocket();
        Scanner sc = new Scanner(System.in);

        while (true) {
            String str = sc.nextLine();
            if ("886".equals(str)) {
                break;
            }
            byte[] bytes = str.getBytes();
            DatagramPacket dp = new DatagramPacket(bytes,
                    bytes.length,
                    InetAddress.getByName("127.0.0.1"),
                    10086);
            ds.send(dp);
        }
        ds.close();
    }
}
